package acm.蓝桥排序枚举杯;

import java.util.Scanner;

public class A {
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        int n = sc.nextInt();
        sc.nextLine();
        while (n-- > 0) {
            int[] gaps1 = getGaps(sc.nextLine());
            int[] gaps2 = getGaps(sc.nextLine());
            String str="";
            for (int i = 0; i < gaps2.length; i++) {
                int res = (gaps1[i] + gaps2[i])/2;
                str+=(res<10?"0"+res:res)+":";
            }
            System.out.println(str.substring(0,str.length()-1));
        }
    }
    public static int[] getGaps(String str){
        int add=0;
        if (str.charAt(str.length()-1)==')') {
            add=str.charAt(str.length()-2)-48;
            str=str.substring(0,str.indexOf(" ("));
        }
        String[] strs = str.split(" ");
        String[] s = strs[0].split(":");
        String[] e = strs[1].split(":");
        int[][] nums=new int[2][3];
        for (int i = 0; i < s.length; i++) {
            nums[0][i]=Integer.parseInt(s[i]);
        }
        for (int i = 0; i < e.length; i++) {
            nums[1][i]=Integer.parseInt(e[i]);
        }
        nums[1][0]+=add*24;
        int[] gaps=new int[3];
        for (int i = 2; i >= 0; i--) {
            gaps[i]=nums[1][i]-nums[0][i];
            if (gaps[i]<0){
                gaps[i]+=60;
                nums[1][i-1]--;
            }
        }
        return gaps;
    }
}
